// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import store from './store/index.js'

Vue.config.productionTip = false
Vue.use(ElementUI);

import axios from 'axios'
Vue.prototype.$axios = axios
axios.defaults.baseURL = '/api'  //关键代码


Vue.prototype.bus = new Vue();

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  store: store,
  watch:{   //监听路由变化
    $route( to , from ){ 
        //console.log(to,from);  
        if(to.path !== '/library/list' && to.path !=='/project_detail/list'){
            //console.log("路由变化");
            this.$store.commit('restoreLevel');
        }
        deep: true
    }
  }
})
